<?php

namespace App\Models\Business;

// 引入模块
use Illuminate\Database\Eloquent\Model;
use App\Traits\SerializeDate;

/**
 * 充值数据模型
 */
class Pay extends Model
{
    use SerializeDate;
    // 设置当前模型对应的完整数据表名称
    protected $table = 'pay';

    protected $dateFormat = 'U';
    // 定义创建时间的字段
    const CREATED_AT = 'createtime';

    const UPDATED_AT = null;

    // 允许批量赋值
    protected $guarded = [];

    protected $appends = [
        'status_text', // 状态
    ];

    protected $casts = [
        'createtime'   => 'datetime:Y-m-d H:i:s'
    ];

    // 状态
    public function getStatusTextAttribute($value)
    {
        $list = ['0' => '未审核', '1' => '已审核' ,'2' => '审核未通过'];
        $del = $this->attributes['status'] ? $this->attributes['status'] : 0;
        return $list[$del];
    }
}
